<template>
  <a-modal
    v-model="show"
    title="排序"
    width="400px"
    @ok="editSort"
    @cancel="cancel"
  >
    <a-form-model
      ref="form"
      label-width="110px"
      v-bind="{
        labelCol: {
          xs: { span: 20 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 14 },
        },
      }"
    >
      <a-form-model-item label="ID">
        <a-input
          disabled
          v-model="editArr.id"
        />
      </a-form-model-item>
      <a-form-model-item label="排序">
        <a-input-number
          style="width:100%"
          v-model="editArr.orderNum"
        />
      </a-form-model-item>
    </a-form-model>
  </a-modal>
</template>

<script>
export default {
  data() {
    return {
      show: false,
      editArr: {},
    };
  },
  methods: {
    open(record) {
      this.editArr = record;
      this.show = true;
    },
    // 关闭弹窗
    cancel() {
      this.show = false;
      this.editArr = {};
    },

    editSort() {
      if (this.editArr.orderNum!=''||this.editArr.orderNum==0) {
        this.$emit("updateOrderNum", this.editArr.id, this.editArr.orderNum);
        this.cancel()
      }
    },
  },
};
</script>

<style>
</style>